package cn.maihe.elg.operation.centers.guogu.enums;

import java.util.Arrays;

/**
 * @Description
 * @Author SSX
 * @Date 2025/03/18
 */
public enum GuoGuRespCodeEnum {
    SUCCESS("200", "成功"),
    FAILURE("500", "失败");
    private String respCode;
    private String respDesc;

    GuoGuRespCodeEnum(String respCode, String respDesc) {
        this.respCode = respCode;
        this.respDesc = respDesc;
    }

    public String getRespCode() {
        return respCode;
    }

    public String getRespDesc() {
        return respDesc;
    }

    public static GuoGuRespCodeEnum resolve(String respCode) {
        return Arrays.stream(values()).filter(cur -> cur.respCode.equals(respCode)).findFirst().orElseThrow(() -> new RuntimeException("未识别的响应码[" + respCode + "]"));
    }

    public static boolean isSuccess(String respCode){
        return SUCCESS.getRespCode().equals(respCode);
    }
}
